package com.mdd.front.controller.security;

import com.mdd.cms.service.security.SecurityStudioService;
import com.mdd.cms.vo.SecurityStudioDetailVo;
import com.mdd.cms.vo.SecurityStudioListVo;
import com.mdd.common.aop.NotLogin;
import com.mdd.common.base.page.PageValidate;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.core.PageResult;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/**
 * 安全学习
 *
 * @Description
 * @Author 幻速
 * @Date 2024/1/30 10:36
 **/
@RestController
@RequestMapping("api/security")
@Api(tags = "安全学习列表")
public class SecurityStudioController {
    @Resource
    SecurityStudioService securityStudioService;
    /**
     * 查询推荐内容列表
     * @return
     */
    @NotLogin
    @GetMapping("/tops")
    public AjaxResult<List<SecurityStudioListVo>> tops(){
        return AjaxResult.success(securityStudioService.tops());
    }
    /**
     * 查询内容列表
     * @param pageValidate
     * @return
     */
    @NotLogin
    @GetMapping("/pages")
    public AjaxResult<PageResult<SecurityStudioListVo>> pages(@Validated PageValidate pageValidate){
        return AjaxResult.success(securityStudioService.pages(pageValidate,null));
    }

    /**
     * 根据sid查询内容
     * @param sid
     * @return
     */
    @NotLogin
    @GetMapping("/detail")
    public AjaxResult<SecurityStudioDetailVo> detail(@RequestParam("sid") Long sid){
        return AjaxResult.success(securityStudioService.getDetail(sid));
    }
}
